Table Effects
Functions to generate effects.
Functions
Tables
ParticleData | Structure for EmitAdvancedParticle table. |
Functions
- EmitLightningArc(origin, target, [color.], [life], [amplitude], [beamWidth], [detail], [smooth], [endDrift])
-
Emit a lightning arc.
Parameters:
- origin Vec3
- target Vec3
- color. Color Default: Color(255, 255, 255).
- life float Lifetime in seconds. Clamped to [0, 4.233] for now because of strange internal maths. Default: 1.
- amplitude int Strength of the lightning - the higher the value, the "taller" the arcs. Clamped to [1, 255]. Default: 20.
- beamWidth int Beam width. Clamped to [1, 127]. Default: 2.
- detail int Higher numbers equal more segments, but it's not a 1:1 correlation. Clamped to [1, 127]. Default: 10.
- smooth bool If true, the arc will have large, smooth curves; if false, it will have small, jagged spikes. Default: false.
- endDrift bool If true, the end of the arc will be able to gradually drift away from its destination in a random direction. Default: false.
- EmitParticle(pos, vel, spriteID, [gravity], [rotVel], [startColor], [endColor], [blendMode], [startSize], [endSize], [life], [damage], [poison], [spriteSeqID], [startRot])
-
Emit a particle.
Parameters:
- pos Vec3 World position.
- vel Vec3 Directional velocity.
- spriteID int Sprite ID in the sprite sequence slot.
- gravity float Effect of gravity. Positive value ascends, negative value descends. Default: 0.
- rotVel float Rotational velocity in degrees. Default: 0.
- startColor Color Color at start of life. Default: Color(255, 255, 255).
- endColor Color Color at end of life. This will finish long before the end of the particle's life due to internal math. Default: Color(255, 255, 255).
- blendMode BlendID Render blend mode. Default: TEN.Effects.BlendID.ALPHA_BLEND.
- startSize float Size at start of life. Default: 10.
- endSize float Size at end of life. Default: 0.
- life float Lifespan in seconds. Default: 2.
- damage bool Harm the player on collision. Default: false.
- poison bool Poison the player on collision. Default: false.
- spriteSeqID SpriteConstants Sprite sequence slot ID. Default: Objects.ObjID.DEFAULT_SPRITES.
- startRot float Rotation at start of life. Default: random.
Usage:
EmitParticle( pos, Vec3(math.random(), math.random(), math.random()), 22, -- spriteID 0, -- gravity -2, -- rotVel Color(255, 0, 0), -- startColor Color(0, 255, 0), -- endColor TEN.Effects.BlendID.ADDITIVE, -- blendMode 15, -- startSize 50, -- endSize 20, -- life false, -- damage true, -- poison Objects.ObjID.DEFAULT_SPRITES, -- spriteSeqID 180) -- startRot
- EmitAdvancedParticle(particleData)
-
Emit a particle with extensive configuration options, including sprite sequence animation, lights, sounds, and damage effects.
Parameters:
- particleData ParticleData Table containing particle data.
Usage:
local particle = { pos = GetMoveableByName("camera_target_6"):GetPosition(), vel = Vec3(0, 0, 10), spriteSeqID = TEN.Objects.ObjID.CUSTOM_BAR_GRAPHIC, spriteID = 0, life = 10, maxYVel = 0, gravity = 0, friction = 10, startRot = 0, rotVel = 0, startSize = 80, endSize = 80, startColor = TEN.Color(128, 128, 128), endColor = TEN.Color(128, 128, 128), blendMode = TEN.Effects.BlendID.ADDITIVE, wind = false, damage = true, poison = false, burn = false, damageHit = 80, soundID = 197, light = true, lightRadius = 6, lightFlicker = 5, animated = true, frameRate = 0.25, animType = TEN.Effects.ParticleAnimationType.LOOP, } EmitAdvancedParticle(particle)
- EmitShockwave(pos, [innerRadius], [outerRadius], [color], [lifetime], [speed], [angle], [hurtsLara])
-
Emit a shockwave, similar to that seen when a harpy projectile hits something.
Parameters:
- pos Vec3 Origin Position.
- innerRadius int Initial inner radius of the shockwave circle - 128 will be approx a click, 512 approx a block. Default: 0.
- outerRadius int Initial outer radius of the shockwave circle. Default: 128.
- color Color Color. Default: Color(255, 255, 255).
- lifetime float Lifetime in seconds (max 8.5 because of inner maths weirdness). Default: 1.0.
- speed int Initial speed of the shockwave's expansion (the shockwave will always slow as it goes). Default: 50.
- angle int Angle about the X axis - a value of 90 will cause the shockwave to be entirely vertical. Default: 0.
- hurtsLara bool If true, the shockwave will hurt Lara, with the damage being relative to the shockwave's current speed. Default: false.
- EmitLight(pos, [color], [radius], [shadows], [name])
-
Emit dynamic light that lasts for a single frame.
If you want a light that sticks around, you must call this each frame.
Parameters:
- pos Vec3 position of the light
- color Color light color. Default: Color(255, 255, 255).
- radius int Measured in "clicks" or 256 world units. Default: 20.
- shadows bool Determines whether light should generate dynamic shadows for applicable moveables. Default: false.
- name string If provided, engine will interpolate this light for high framerate mode (be careful not to use same name for different lights). Optional.
- EmitSpotLight(pos, dir, [color], [radius], [falloff], [distance], [shadows], [name])
-
Emit dynamic directional spotlight that lasts for a single frame.
If you want a light that sticks around, you must call this each frame.
Parameters:
- pos Vec3 position of the light
- dir Vec3 normal which indicates light direction
- color Color Color. Default: Color(255, 255, 255).
- radius int Overall radius at the endpoint of a light cone, measured in "clicks" or 256 world units. Default: 10.
- falloff int Radius, at which light starts to fade out, measured in "clicks". Default: 5.
- distance int Distance, at which light cone fades out, measured in "clicks". Default: 20.
- shadows bool Determines whether light should generate dynamic shadows for applicable moveables. Default: false.
- name string If provided, engine will interpolate this light for high framerate mode (be careful not to use same name for different lights). Optional.
- EmitBlood(pos, [count])
-
Emit blood.
Parameters:
- pos Vec3
- count int Sprite count. Default: 1.
- EmitAirBubble(pos, [size], [amp])
-
Emit an air bubble in a water room.
Parameters:
- pos Vec3 World position where the effect will be spawned. Must be in a water room.
- size float Sprite size. Default: 32.
- amp float Oscillation amplitude. Default: 32.
- EmitFire(pos, [size])
-
Emit fire for one frame. Will not hurt player. Call this each frame if you want a continuous fire.
Parameters:
- pos Vec3 Position.
- size float Fire size. Default: 1.
- MakeExplosion(pos, [size], [shockwave])
-
Make an explosion. Does not hurt Lara
Parameters:
- pos Vec3
- size float This will not be the size of the sprites, but rather the distance between the origin and any additional sprites. Default: 512.
- shockwave bool If true, create a very faint white shockwave which will not hurt Lara. Default: false.
- MakeEarthquake([strength])
-
Make an earthquake
Parameters:
- strength int How strong should the earthquake be? Increasing this value also increases the lifespan of the earthquake. Default: 100.
- GetWind()
-
Get the wind vector for the current game frame.
This represents the 3D displacement applied by the engine on things like particles affected by wind.()
Returns:
-
Vec3
Wind vector.
- EmitStreamer(mov, tag, pos, dir, [rot], [startColor], [endColor], [width], [life], [vel], [expRate], [rotRate], [edgeFeatherMode], [lengthFeatherMode], [blendID])
-
Emit an extending streamer effect.
Parameters:
- mov Moveable Moveable object with which to associate the effect.
- tag int Numeric tag with which to associate the effect on the moveable.
- pos Vec3 World position.
- dir Vec3 Direction vector of movement velocity.
- rot float Start rotation in degrees. Default: 0.
- startColor Color Color at the start of life. Default: Color(255, 255, 255).
- endColor Color Color at the end of life. Default: Color(0, 0, 0).
- width float Width in world units. Default: 0.
- life float Lifetime in seconds. Default: 1.
- vel float Movement velocity in world units per second. Default: 0.
- expRate float Width expansion rate in world units per second. Default: 0.
- rotRate float Rotation rate in degrees per second. Default: 0.
- edgeFeatherMode StreamerFeatherMode Edge feather mode. Default: Effects.StreamerFeatherMode.NONE.
- lengthFeatherMode StreamerFeatherMode Length feather mode. Not yet implemented. Default: Effects.StreamerFeatherMode.LEFT.
- blendID BlendID Renderer blend ID. Default: Effects.BlendID.ALPHA_BLEND.
Tables
- ParticleData
-
Structure for EmitAdvancedParticle table.
Fields:
- pos Vec3 World position.
- vel Vec3 Directional velocity in world units per second.
- spriteSeqID SpriteConstants Sprite sequence slot ID. Default: Objects.ObjID.DEFAULT_SPRITES.
- spriteID int Sprite ID in the sprite sequence slot. Default: 0.
- life float Lifespan in seconds. Default: 2.
- maxYVel float Maximum vertical velocity in world units per second. Default: 0.
- gravity float Effect of gravity in world units per second. Positive value ascend, negative value descend. Default: 0.
- friction float Friction affecting velocity over time in world units per second. Default: 0.
- startRot float Rotation at start of life. Default: random.
- rotVel float Rotational velocity in degrees per second. Default: 0.
- startSize float Size at start of life. Default: 10.
- endSize float Size at end of life. Default: 0.
- startColor Color Color at start of life. Default: Color(255, 255, 255).
- endColor Color Color at end of life. Note that this will finish long before the end of life due to internal math. Default: Color(255, 255, 255).
- blendMode BlendID Render blend mode. Default: TEN.Effects.BlendID.ALPHA_BLEND.
- damage bool Harm the player on collision. Default: false.
- poison bool Poison the player on collision. Default: false.
- burn bool Burn the player on collision. Default: false.
- wind bool Affect position by wind in outside rooms. Default: false.
- damageHit int Player damage amount on collision. Default: 2.
- light bool Emit a colored light. Caution: Recommended only for a single particle. Too many particles with lights can overwhelm the lighting system. Default: false.
- lightRadius int Light radius in 1/4 blocks. Default: 0.
- lightFlicker int Interval at which the light should flicker. Default: 0.
- soundID int Sound ID to play. Caution: Recommended only for a single particle. Too many particles with sounds can overwhelm the sound system. Optional.
- animated bool Play animates sprite sequence. Default: false.
- animType ParticleAnimationType Animation type of the sprite sequence. Default: TEN.Effects.ParticleAnimationType.LOOP.
- frameRate float Sprite sequence animation framerate. Default: 1.